#include "DataManager.h"

DataManager* DataManager::_instance = 0;
//--------------------------------------------------------------
DataManager* DataManager::getDataManagerAsSingleton()
{
	if(_instance == NULL)
		_instance = new DataManager();
	
	return _instance;
}
//--------------------------------------------------------------
DataManager::DataManager()
:	sceneManager(0),
	freeLookCamera(0),
	mainViewport(0), 
	sdkTrayManager(0)
{
}
//--------------------------------------------------------------
DataManager::~DataManager()
{

}

//--------------------------------------------------------------
void DataManager::initializeDataManager(Ogre::SceneManager* sceneManager, Ogre::Camera* freeLookCamera,Ogre::Viewport* mainViewport, Ogre::RenderWindow* window, OgreBites::SdkTrayManager* sdkTrayManager)
{
	this->sceneManager = sceneManager;
	this->freeLookCamera = freeLookCamera;
	this->mainViewport = mainViewport;
	this->window = window;
	this->sdkTrayManager = sdkTrayManager;
}

//--------------------------------------------------------------
Ogre::SceneManager* DataManager::getSceneManager()
{
	if(!sceneManager)
	{
		if(VERBOSE_MODE > 0)
			VERBOSE_STRING("(DataManager): SceneManager was not initialized in DataManager!");
		return 0;
	}

	return sceneManager;
}

//--------------------------------------------------------------
Ogre::Camera*	DataManager::getFreeLookCamera()
{
	if(!freeLookCamera)
	{
		if(VERBOSE_MODE > 0)
			VERBOSE_STRING("(DataManager): freeLookCamera was not initialized in DataManager!");
		return 0;
	}

	return freeLookCamera;
}

//--------------------------------------------------------------
Ogre::Viewport* DataManager::getMainViewport()
{
	if(!mainViewport)
	{
		if(VERBOSE_MODE > 0)
			VERBOSE_STRING("(DataManager): mainViewport was not initialized in DataManager!");
		return 0;
	}
	return mainViewport;
}

//--------------------------------------------------------------
Ogre::RenderWindow* DataManager::getMainWindow()
{
	if(!window)
	{
		if(VERBOSE_MODE > 0)
			VERBOSE_STRING("(DataManager): window was not initialized in DataManager!");

		return 0;
	}
	return window;
}

//--------------------------------------------------------------

OgreBites::SdkTrayManager* DataManager::getSdkTrayManager()
{
	if(!sdkTrayManager)
	{
		if(VERBOSE_MODE > 0)
			VERBOSE_STRING("(DataManager): sdkTrayManager was not initialized in DataManager!");
		return 0;
	}
	return sdkTrayManager;
}

//--------------------------------------------------------------

void DataManager::setSceneManager(Ogre::SceneManager* sceneManager)
{
	this->sceneManager = sceneManager;
}

//--------------------------------------------------------------
void DataManager::setFreeLookCamera(Ogre::Camera* freeLookCamera)
{
	this->freeLookCamera = freeLookCamera;
}

//--------------------------------------------------------------
void DataManager::setMainViewport(Ogre::Viewport* mainViewport)
{
	this->mainViewport = mainViewport;
}
//--------------------------------------------------------------
void DataManager::setSdkTrayManager(OgreBites::SdkTrayManager* sdkTrayManager)
{
	this->sdkTrayManager = sdkTrayManager;
}

